package com.lwj.charts.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lwj.charts.commonutils.Result;
import com.lwj.charts.pojo.Line;
import com.lwj.charts.service.LineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lwj
 * @since 2021-10-11
 */
@CrossOrigin
@RestController
@RequestMapping("/charts/line")
public class LineController {
    @Autowired
    LineService lineService;
    @GetMapping("getLeft")
    public Result getLeft() {
        QueryWrapper<Line> wrapper =new QueryWrapper<>();
        wrapper.last("limit 30,12");
        List<Line> list = lineService.list(wrapper);
        return Result.ok().data("list", list);
    }
    @GetMapping("getRight")
    public Result getRight() {
        QueryWrapper<Line> wrapper =new QueryWrapper<>();
        wrapper.last("limit 30");
        List<Line> list = lineService.list(wrapper);
        return Result.ok().data("list", list);
    }
}

